{include file="public/header" title="找回密码"/}
								<!-- 找回密码框 -->
								<div class="mb-4 login-page-title">
									<p>找回您遗忘的密码</p>
								</div>
					<form id="formAuthentication" class="mb-3 layui-form">
								<div class="row">
								    {if condition="$config['retrieve-type'] == 1"}
								        <div class="mb-3">
    				                        <label class="form-label">手 机 号</label>
    				    <input
                            type="text"
                            class="form-control"
                            name="mobile"
                            id="mobile"
                            placeholder="请 输 入 您 的 手 机 号"
                            autofocus
                        />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">短 信 验 证 码</label>
                        <div class="input-group">
                            <input
                                type="text"
                                class="form-control"
                                name="captcha"
                                id = "numeral-mask"
                                placeholder="请 输 入 短 信 验 证 码"
                            />
                            <button class="btn btn-outline-secondary"
    														type="button" id="send-code">发送验证码</button>
                        </div>
                    </div>
								    {elseif condition="$config['retrieve-type'] == 2"}
									    <div class="mb-3">
    				    <label class="form-label">邮 箱</label>
    				    <input
                            type="email"
                            class="form-control"
                            name="email"
                            id="email"
                            placeholder="请 输 入 您 的 邮 箱"
                            autofocus
                        />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">邮 箱 验 证 码</label>
                        <div class="input-group">
                            <input
                                type="text"
                                class="form-control"
                                name="captcha"
                                id = "numeral-mask"
                                placeholder="请 输 入 邮 箱 验 证 码"
                            />
                            <button class="btn btn-outline-secondary"
    														type="button" id="send-code">发送验证码</button>
                        </div>
                    </div>
									{/if}
									
                {if condition="$config['captcha-type'] == '1'"}
                    <div class="mb-3">
                      <label class="form-label">验 证 码</label>
                      <div class="input-group">
                        <input
                            type="text"
                            class="form-control"
                            name="ordinary_captcha"
                            placeholder="请 输 入 验 证 码"
                        />
                        <img id="codeimg" class="login-captcha"  alt="验证码" style="display:block;"/>
                      </div>
                    </div>

                {/if}
									<div class="col-lg-12 mb-0">
										<button class="btn btn-primary w-100 go-rest-password" lay-filter="loginSubmit"
											lay-submit>立即找回密码</button>
									</div>
									<div class="col-12 text-center">
										<p class="mb-0 mt-3"><small class="mr-2">不想找回？</small> <a href="/User/Login"
												class="btn-link">立即登录</a>		
												</p>
									</div>
								</div>


								<!-- End Button -->
							</form>
							<!-- End Form -->
						</div>

					</div>
				</div>




			</main><!-- #main -->

		</div><!-- #page -->
		 <footer class="footer footer-bar" style="margin-top:-3%;">
    <div class="container text-center">
        <div class="row align-items-center">
            <div>
                <div class="text-sm-left">
                  {:getConfig()['copyright']}</p>
                </div>
            </div>
        </div>
    </div>
</footer>
		<!-- js部分 -->
		    <!-- Main JS -->
    <script src="https://open_hk1.ygit.net/static/index/user/assets/js/main.js"></script>
     <script src="/static/component/layui/layui.js"></script>
    <script src="/static/component/pear/pear.js"></script>
        <!-- Other JS -->
    <script src="https://open_hk1.ygit.net/static/index/user/assets/vendor/libs/cleavejs/cleave.js"></script>
    <script src="https://open_hk1.ygit.net/static/index/user/assets/vendor/libs/cleavejs/cleave-phone.js"></script>
		<script>
			layui.use(['layer', 'form', 'formX'], function() {
				var $ = layui.jquery;
				var layer = layui.layer;
				var form = layui.form;
				var formX = layui.formX;
				
					//验证输入的验证码是否为数字
    const numeralMask = document.querySelector('#numeral-mask')
      //Numeral
    if (numeralMask) {
      new Cleave(numeralMask, {
        numeral: true,
        numeralThousandsGroupStyle: 'false'
      });
    }
				
				/* 表单提交 */
				form.on('submit(loginSubmit)', function(obj) {
					var loadIndex = layer.load(2);
					$.post('/User/LostPwd', obj.field, function(res) {
						layer.close(loadIndex);
						if (res.code === 200) {
							layer.msg('新密码为[123456],请及时登录用户中心修改!!!', {
								icon: 1,
								time: 5000
							}, function() {
								location.replace('/User/Login');
							});
						} else {
							layer.msg(res.msg, {
								icon: 2,
								anim: 6
							});
						}
					}, 'json');
					return false;
				});
				
				
				// 获取验证码
				$('#send-code').click(function(data) {
					var email = $("#email").val();
					var mobile = $("#mobile").val();
					var type = "{:$config['retrieve-type']}";
					if(type==1){
                        if (mobile == null || mobile == "") {
                        layer.msg("请输入您的手机号", { icon: 2, anim: 6 });
                        f5Captcha();
                        return false;
                    }
                    }else{
                        if (email == null || email == "") {
                        layer.msg("请输入您的邮箱", { icon: 2, anim: 6 });
                        f5Captcha();
                        return false;
                    }
                    }
					//点击一次之后禁止继续点击
                $('#send-code').attr('disabled',"true");
					$.post('/User/getLostCode', {
						email: email,
						mobile: mobile
					}, function(res) {
						if (res.code === 200) {
							setTimeout(function() {
								formX.startTimer('#send-code', 60, function(t) {
									return '已发送(' + t + 's)';
								});
							}, 600);
							//倒计时结束之后恢复点击
                        $('#send-code').removeAttr("disabled");
							return false;
						} else {
							layer.msg(res.msg, {
								icon: 2,
								anim: 6
							});
							//返回信息后恢复点击
                        $('#send-code').removeAttr("disabled");
						}
					}, 'json');
					return false;
				});

      /* 图形验证码 */
		var captchaUrl = '/User/Verify';
		$('img.login-captcha').click(function() {
		    f5Captcha();
		}).trigger('click');
        
        f5Captcha();
        function f5Captcha(){
            var img = captchaUrl + '?t=' + (new Date).getTime();
            $('img.login-captcha').attr('src',img);
        }

			});
		</script>
	</body>
</html>
